package com.datastructure.test.minnumberofcombinearray;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

public class MinNumberOfCombineArray {

    public static void main(String[] args) {

    }

    public String PrintMinNumber(int [] numbers) {
        if(numbers==null||numbers.length==0){
            return "";
        }
        List<String> list = Arrays.stream(numbers).mapToObj(String::valueOf).sorted((k1, k2)->(k1+k2).compareTo(k2+k1)).collect(Collectors.toList());
        return "0".equals(list.get(0))?"0":String.join("",list);
    }
}
